package com.ljx.recruitment.interview.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ljx.recruitment.interview.enums.DeliverStatusEnum;
import com.ljx.recruitment.interview.typehandler.DeliverDetailsTypeHandler;
import com.ljx.recruitment.interview.typehandler.details.DeliverDetails;
import com.ljx.recruitment.user.typehandler.TenantResumeTypeHandler;
import com.ljx.recruitment.user.typehandler.details.ResumeDetails;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-11-02  00:05
 */
@Data
@TableName("tb_deliver")
public class Deliver {

    private Long id;

    private Long uId;

    private Long jobId;

    private Integer deliverStatus;

    @TableField(typeHandler = DeliverDetailsTypeHandler.class)
    private DeliverDetails deliverDetails;

    @TableField(typeHandler = TenantResumeTypeHandler.class)
    private ResumeDetails resumeDetails;

    private Integer isRecommend;

    private String  recommendCode;

    private Integer batch;

    private Date createTime;

    private Date updateTime;

    private Integer status;

    private Integer ver;

    public Boolean isOfferStage(){
        return DeliverStatusEnum.OFFER.getKey().equals(deliverStatus);
    }

    public Boolean isOverStage(){
        return DeliverStatusEnum.OVER.getKey().equals(deliverStatus);
    }

    public Boolean isRejectStage(){
        return deliverStatus % 2 == 0;
    }

    public Boolean isProcessIngStage(){
        return deliverStatus % 2 == 1;
    }

}
